module(
    name = "rules_squashfs",
    version = "1.0.0-alpha.1",
    bazel_compatibility = [
        ">=7.0.0",
    ],
    compatibility_level = 1,
)

bazel_dep(name = "rules_coreutils", version = "1.0.0-alpha.7")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.1")
bazel_dep(name = "squashfs-tools", version = "4.6.1")

bazel_dep(name = "hermetic_cc_toolchain", version = "2.2.3", dev_dependency = True)

which = use_repo_rule("@toolchain_utils//toolchain/local/which:defs.bzl", "toolchain_local_which")

resolved = use_repo_rule("@toolchain_utils//toolchain/resolved:defs.bzl", "toolchain_resolved")

[
    (
        which(
            name = "which-{}".format(tool),
        ),
        resolved(
            name = "resolved-{}".format(tool),
            basename = tool,
            toolchain_type = "//squashfs/toolchain/{}:type".format(tool),
        ),
    )
    for tool in ("mksquashfs", "unsquashfs", "sqfstar")
]

register_toolchains("//squashfs/toolchain/...")
